package cn.zlj.pethome.org.mapper;

import cn.zlj.pethome.org.domain.TDepartment;
import cn.zlj.pethome.org.query.QueryPage;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DepartmentMapper {
    @Select("select * from t_department")
    List<TDepartment> getList();

    @Select("select * from t_department where id=#{id}")
    TDepartment getOne(Long id);
    //@Select("select * from t_department limit #{pageStart},#{pageSize} ")
    List<TDepartment> queryPage(QueryPage page);

    //@Select("select count(*) from t_department")
    Integer queryPageCount(QueryPage page);

    @Delete("delete from t_department where id=#{id} ")
    void del(Long id);

    void batchDel(List<Long> ids);

     @Update("update t_department set sn=#{sn},name=#{name},dirPath=#{dirPath},state=#{state},\n" +
             "manager_id=#{managerId},parent_id=#{parentId} where id=#{id}")
    void update(TDepartment tDepartment);

      @Insert("insert into t_department(sn,name,dirPath,state,manager_id,parent_id) values(#{sn}, #{name}, #{dirPath}, #{state}, #{managerId}, #{parentId}) ")
     void save(TDepartment tDepartment);

}
